// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   getStaticReport_excel.java

package stock.analyse;

import include.excel_export.XlsWriter;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class getStaticReport_excel extends HttpServlet
{

	public getStaticReport_excel()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		XlsWriter xls = new XlsWriter((String)dbSession.getAttribute("unit_db_name"), "xml/stock/static_report.xml");
		try
		{
			String static_report_ID = request.getParameter("static_report_ID");
			String sql = (new StringBuilder("where static_report_ID='")).append(static_report_ID).append("'").toString();
			int a = sql.indexOf("where");
			sql = sql.substring(a, sql.length());
			xls.setCondition(sql);
			ServletContext context = session.getServletContext();
			String path = context.getRealPath("/");
			xls.write((new StringBuilder(String.valueOf(path))).append("excel_files/stock_report_data.xls").toString());
			response.sendRedirect("stock/analyse/getStaticReport_excel_a.jsp");
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
